package com.autumn.oauth2.zero.userdetails;

import com.autumn.oauth2.zero.domain.entities.AbstractUser;
import com.autumn.oauth2.zero.domain.entities.AbstractUserLoginProvider;
import com.autumn.security.core.userdetails.AccountNotFoundException;
import com.autumn.security.core.userdetails.IAutumnUserDetailsService;
import com.autumn.security.core.userdetails.ProviderNotFoundException;
import com.autumn.security.core.userdetails.UserProviderLoginInfo;

/**
 * 用户服务抽象
 * 
 * @author 老码农 2018-04-10 00:23:09
 * @param <TUser>
 *            用户类型
 * @param <TUserLoginProvider>
 *            用户登录提供者类型 
 */
public interface IAutumnUserBaseService<TUser extends AbstractUser, TUserLoginProvider extends AbstractUserLoginProvider>
		extends IAutumnUserDetailsService {

	@Override
	TUser loadUserByUsername(String username) throws AccountNotFoundException;

	@Override
	TUser loadUserByProvider(UserProviderLoginInfo userProviderLoginInfo) throws ProviderNotFoundException;

	/**
	 * 存在用户提供者
	 * 
	 * @param userProviderLoginInfo
	 *            登录提供者
	 * @return
	 */
	boolean existUserProvider(UserProviderLoginInfo userProviderLoginInfo);
}
